{include file='_header'}
<script type="text/javascript" src="__STATIC__/js/lib/moment.js"></script>
<link rel="stylesheet" href="__STATIC__/components/datetimepicker/jquery.datetimepicker.css">
<link rel="stylesheet" href="__STATIC__/components/daterangepicker/daterangepicker.css">
<style type="text/css">
    .trhead td {  background:#efefef;text-align: center}
    .trbody td {  text-align: center; vertical-align:top;border-left:1px solid #f2f2f2;overflow: hidden; font-size:12px;}
    .trorder { background:#f8f8f8;border:1px solid #f2f2f2;text-align:left;}
    .ops { border-right:1px solid #f2f2f2; text-align: center;}
    .ops a,.ops span{
        margin: 3px 0;
    }
    .table-top .op:hover{
        color: #000;
    }
    .tables{
        border:1px solid #e5e5e5;
        font-size: 12px;
        line-height: 18px;
    }
    .tables:hover{
        border:1px solid #b1d8f5;
    }
    .table-row,.table-header,.table-footer,.table-top{
        display: -webkit-box;
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;
        justify-content: center;
        -webkit-justify-content: center;
        -webkit-align-content: space-around;
        align-content: space-around;
    }
    .tables  .table-row>div{
        padding: 14px 0;
    }
    .tables  .table-row.table-top>div{
        padding: 11px 0;
    }
    .tables    .table-row .ops.list-inner{
        border-right:none;
    }
    .tables .list-inner{
        border-right: 1px solid #efefef;
        vertical-align: middle;
    }
    .table-row .goods-des .title{
        width:180px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .table-row .goods-des{
        width:300px;
        border-right: 1px solid #efefef;
        vertical-align: middle;
    }
    .table-row .list-inner{
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        -ms-flex: 1;
        flex: 1;
        text-align: center;
        display: -webkit-box;
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;
        -webkit-align-items: center;
        align-items: center;
        -webkit-justify-content: center;
        justify-content: center;
        -webkit-flex-direction: column;
        flex-direction: column;
    }
    .saler>div{
        width:130px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .table-row .list-inner.ops,  .table-row .list-inner.paystyle{
        -webkit-flex-direction: column;
        flex-direction: column;
        -webkit-justify-content: center;
        justify-content: center;
    }
    .table-header .others{
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        -ms-flex: 1;
        flex: 1;
        text-align: center;
    }
    .table-footer{
        border-top: 1px solid #efefef;
    }
    .table-footer>div, .table-top>div{
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        -ms-flex: 1;
        flex: 1;
        height:100%;
    }
</style>
<div class="page-header">
    当前位置：<span class="text-primary">订单管理 </span>
</div>
<div class="page-content">
    <div class="main">
        <form action="" method="get" class="form-horizontal table-search" role="form">
            <div class="page-toolbar m-b-sm m-t-sm">
                <div class="col-sm-5">
                    <div class="btn-group btn-group-sm" style='float:left'>
                        {:tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i', $starttime),'endtime'=>date('Y-m-d H:i', $endtime)),true);}
                    </div>
                </div>
                <div class="col-sm-7 pull-right">
                    <div class="input-group">
                        <div class="input-group-select">
                            <select name="paytype" class="form-control input-sm select-md" style="width:100px;">
                                <option value="" {if $_GET['paytype']==''}selected{/if}>支付方式</option>
                                {foreach name='paytype' key='key' item='type'}
                                <option value="{$key}" {if $_GET['paytype'] == "$key"} selected="selected" {/if}>{$type}</option>
                                {/foreach}
                            </select>
                        </div>
                        <div class="input-group-select">
                            <select name='searchtime' class='form-control  input-sm select-md' style="width:100px"  >
                                <option value=''>不按时间</option>
                                <option value='create' {if $_GET['searchtime']=='create'}selected{/if}>下单时间</option>
                                <option value='pay' {if $_GET['searchtime']=='pay'}selected{/if}>付款时间</option>
                                <option value='send' {if $_GET['searchtime']=='send'}selected{/if}>发货时间</option>
                                <option value='finish' {if $_GET['searchtime']=='finish'}selected{/if}>完成时间</option>
                            </select>
                        </div>
                        <div class="input-group-select">
                            <select name='searchfield'  class='form-control  input-sm select-md'   style="width:110px;"  >
                                <option value='ordersn' {if $_GET['searchfield']=='ordersn'}selected{/if}>订单号</option>
                                <option value='member' {if $_GET['searchfield']=='member'}selected{/if}>会员信息</option>
                                <option value='address' {if $_GET['searchfield']=='address'}selected{/if}>收件人信息</option>
                                <option value='expresssn' {if $_GET['searchfield']=='expresssn'}selected{/if}>快递单号</option>
                                <option value='goodstitle' {if $_GET['searchfield']=='goodstitle'}selected{/if}>商品名称</option>
                                <option value='goodssn' {if $_GET['searchfield']=='goodssn'}selected{/if}>商品编码</option>
                            </select>
                        </div>
                        <input type="text" class="form-control input-sm"  name="keyword" value="{$_GET['keyword']}" placeholder="请输入关键词"/>
                        <span class="input-group-btn">
                            <button class="btn btn-primary" type="submit"> 搜索</button>
                            <button type="submit" name="export" value="1" class="btn btn-success">导出</button>
                        </span>
                    </div>
                </div>
            </div>
        </form>
        {if !empty(count($list))}
        <div class="table-row"><div style='height:20px;padding:0;border-top:none;'>&nbsp;</div></div>
        <table class='table table-responsive' style='table-layout: fixed;'>
            <tr style='background:#f8f8f8'>
                <td style='width:60px;border-left:1px solid #f2f2f2;'>商品</td>
                <td style='width:150px;'></td>
                <td style='width:70px;text-align: right;;'>单价/数量</td>
                <td  style='width:100px;text-align: center;'>买家</td>
                <td style='width:100px;text-align: center;'>支付/配送/退款</td>
                <td style='width:100px;text-align: center;'>金额</td>
                <td style='width:100px;text-align: center;'>操作</td>
                <td style='width:90px;text-align: center'>状态</td>
            </tr>
            {foreach name='list' item='item'}
            <tr ><td colspan='8' style='height:20px;padding:0;border-top:none;'>&nbsp;</td></tr>
            <tr class='trorder'>
                <td colspan='4' >
                    <span style="font-weight: bold;margin-right: 10px;color: #2d2d31"> {:date('Y-m-d',$item['createtime'])} {:date('H:i:s',$item['createtime'])}</span>
                    订单编号:  {$item['ordersn']}
                </td>
                <td colspan='4' style='text-align:right;font-size:12px;' class='aops'>
                    <a class='op'  data-toggle="ajaxModal" href="{:url('admin/auction/orderremarksaler', array('id' => $item['id']))}">
                    {if !empty($item['remark'])}
                    <i class="icow icow-flag-o" style="color: #df5254;display: inline-block;vertical-align: middle" title="  查看备注"></i>
                    备注
                    &nbsp
                    {else}
                    <i class="icow icow-yibiaoji" style="color: #999;display: inline-block;vertical-align: middle" title="  添加备注" ></i>
                    备注
                    &nbsp
                    {/if}
                    </a>
                    {if !empty($item['expresssn']) && $item['status']>=2 && !empty($item['addressid'])}
                    <a class='op' data-toggle="ajaxModal" href="{:url('admin/utility/express', array('id' => $item['id'],'express'=>$item['express'],'expresssn'=>$item['expresssn']))}">
                        <i class="icow icow-wuliu" style="color: #999;display: inline-block;vertical-align: middle;"></i>
                        查看物流
                        &nbsp
                    </a>
                    {/if}
                    {if $item['status'] >= 0 && $item['status'] < 3 }
                    <a class='op'  data-toggle='ajaxModal' href="{:url('admin/auction/orderclose',array('id'=>$item['id']))}" >
                        <i class="icow icow-shutDown"  style="color: #999;display: inline-block;vertical-align: middle;"></i>
                        关闭订单
                        &nbsp
                    </a>
                    {/if}
                </td>
            </tr>
            <tr class='trbody'>
                <td style='overflow:hidden;'><img src="{$item['thumb']}" onerror="this.src='/public/static/images/nopic.png'" style='width:50px;height:50px;border:1px solid #ccc; padding:1px;'></td>
                <td style='text-align: left;overflow:hidden;border-left:none;'>{$item['title']}</td>
                <td style='text-align:right;border-left:none;'>
                    {if !$item['title'] && !$item['thumb']}
                    {:number_format($item['price'],2)}
                    {else}
                    ¥ {if $item['is_team']==1}{$item['auctionprice']}{else}{$item['singleprice']}{/if}
                    {/if}
                    <br/>x1
                </td>
                <td  style='text-align: center;' >
                    {if $item['pay_type']=='system'}系统虚拟{/if}
                    <a href="{:url('admin/member/detail',array('id'=>$item['mid']))}"> {$item['nickname']}</a>
                    <br/>
                    {$item['mrealname']}<br/>{$item['mmobile']}
                </td>
                <td style='text-align:center;' >
                    {if $item['pay_type']=='wechat'}
                    <span> <i class="icow icow-weixin text-success" style="font-size: 17px"></i>微信支付</span>
                    {elseif $item['pay_type']=='credit'}
                    <span> <i class="icow icow-yue text-warning" style="font-size: 17px;display:inline-block;height: 17px;width: 17px;padding-top: 3px"></i><span>余额支付</span></span>
                    {elseif $item['pay_type']=='alipay'}
                    <span><i class="icow icow-zhifubao text-primary" style="font-size: 17px"></i>支付宝支付</span>
                    {elseif $item['pay_type']=='system'}
                    <span class='label label-default'>系统虚拟</span>
                    {elseif $item['pay_type']=='other'}
                    <span class='label label-default'>其他</span>
                    {elseif $item['pay_type']==''}
                    <span class='label label-default'>未付款</span>
                    {/if}
                    <br />
                    <span style="margin-top:5px;display:block;">
                        {if !empty($item['addressid'])}
                        快递
                        {elseif $item['dispatchtype']}
                        自提
                        {else}
                        其他
                        {/if}
                    </span>
                    {if $item['refundtime']}
                    <span class='text-default'>已退款</span>
                    {/if}
                </td>
                <td style='text-align:center' >
                    ¥ {:number_format($item['price']-$item['creditmoney']+$item['freight'],2)}
                    <a data-toggle='popover'  data-trigger="hover" data-html='true' data-placement='right' data-content="<table style='width:100%;'>
                    <tr>
                        <td  style='border:none;text-align:right;'>商品小计：</td>
                        <td  style='border:none;text-align:right;;'>
                            ¥ {:number_format($item['price'] + $item['discount'],2)}
                        </td>
                    </tr>
                    <tr>
                        <td  style='border:none;text-align:right;'>运费：</td>
                        <td  style='border:none;text-align:right;;'>¥ {:number_format( $item['freight'],2)}</td>
                    </tr>
                    {if $item['discount']>0}
                    <tr>
                        <td  style='border:none;text-align:right;'>团长优惠：</td>
                        <td  class='text-danger' style='border:none;text-align:right;'>- ¥{$item['discount']}</td>
                    </tr>
                    {/if}
                    {if $item['discountprice']>0}
                    <tr>
                        <td  style='border:none;text-align:right;'>会员折扣：</td>
                        <td  class='text-danger' style='border:none;text-align:right;;'>-¥ {:number_format( $item['discountprice'],2)}</td>
                    </tr>
                    {/if}
                    {if $item['creditmoney']>0}
                    <tr>
                        <td  style='border:none;text-align:right;'>积分抵扣：</td>
                        <td  class='text-danger' style='border:none;text-align:right;;'>-¥ {:number_format( $item['creditmoney'],2)}</td>
                    </tr>
                    {/if}
                    {if $item['deductenough']>0}
                    <tr>
                        <td  style='border:none;text-align:right;'>满额立减：</td>
                        <td  class='text-danger' style='border:none;text-align:right;;'>-¥ {:number_format( $item['deductenough'],2)}</td>
                    </tr>
                    {/if}
                    {if $item['couponprice']>0}
                    <tr>
                        <td  style='border:none;text-align:right;'>优惠券优惠：</td>
                        <td class='text-danger'  style='border:none;text-align:right;;'>-¥ {:number_format( $item['couponprice'],2)}</td>
                    </tr>
                    {if $item['isdiscountprice']>0}
                    <tr>
                        <td  style='border:none;text-align:right;'>促销优惠：</td>
                        <td  class='text-danger' style='border:none;text-align:right;;'>-¥ {:number_format( $item['isdiscountprice'],2)}</td>
                    </tr>
                    {/if}
                    {/if}
                    {if intval($item['changeprice'])!=0}
                    <tr>
                        <td  style='border:none;text-align:right;'>卖家改价：</td>
                        <td  style='border:none;text-align:right;;'>
                        <span class='{if 0<$item['changeprice']}text-success{else}text-danger{/if}'>
                        {if 0<$item['changeprice']}+{else}-{/if}¥ {:number_format(abs($item['changeprice']),2)}
                        </span>
                        </td>
                    </tr>
                    {/if}
                    {if intval($item['changedispatchprice'])!=0}
                    <tr>
                        <td  style='border:none;text-align:right;'>卖家改运费：</td>
                        <td  style='border:none;text-align:right;;'>
                            <span class='{if 0<$item['changedispatchprice']}text-success{else}text-danger{/if}'>
                            {if 0<$item['changedispatchprice']}+{else}-{/if}¥ {:abs($item['changedispatchprice'])}
                            </span>
                        </td>
                    </tr>
                    {/if}
                    <tr>
                        <td style='border:none;text-align:right;'>应收款：</td>
                        <td style='border:none;text-align:right;font-weight:bold'>¥ {:number_format($item['price']-$item['creditmoney']+$item['freight'],2)}</td>
                    </tr>
                </table>">
                        <i class='fa fa-question-circle'></i></a>
                    {if $item['freight']>0}
                    <br/>(含运费:¥ {:number_format( $item['freight'],2)})
                    {/if}
                </td>
                <td style='text-align:center' >
                    <a class='op text-primary'  href="{:url('admin/auction/orderdetail', array('orderid' => $item['id']))}" >查看详情</a>
                </td>
                <td  class='ops' style='line-height:20px;text-align:center' >
                    {if $item['status'] == 0}<span class='text-warning'>待付款</span>{/if}
                    {if $item['is_team']==1}
                        {if $item['status'] == 1 && $item['success'] == 0}<span class='text-success'>已付款</span>{/if}
                        {if $item['status'] == 1 && $item['success'] == 1}
                        {if $item['isverify'] == 1}
                        <span class='text-warning'>待核销</span>{else}
                        <span class='text-warning'>待发货</span>
                        {/if}{/if}
                        {if $item['status'] == 1 && $item['success'] == -1}<span class='text-warning'>待退款</span>{/if}
                    {else}
                        {if $item['status'] == 1}
                            {if $item['isverify'] == 1}<span class='text-warning'>待核销</span>{else}
                            <span class='text-warning'>待发货</span>
                            {/if}
                        {/if}
                    {/if}
                    {if $item['deleted'] == 1}
                        <span class='text-default'>用户已删除</span>
                    {else}
                        {if $item['status'] == 2}<span class='text-warning'>待收货</span>{/if}
                        {if $item['status'] == 3}<span class='text-success'>已完成</span>{/if}
                        {if $item['status'] == -1}<span class='text-default'>已取消</span>{/if}
                    {/if}
                    <br />
                    {include file='auction/order/ops'}
                </td>
            </tr>
            <tr style="border-bottom:none;background:#f9f9f9;">
                <td colspan='8' style='text-align:left;height:0;padding:0'></td>
            </tr>
            {/foreach}
        </table>
        <div style="text-align:right;width:100%;">
            {$pager}
        </div>
        {else}
        <div class='panel panel-default'>
            <div class='panel-body' style='text-align: center;padding:30px;'>
                暂时没有任何订单!
            </div>
        </div>
        {/if}
    </div>
</div>
{include file='_footer'}